unit TabControl;

interface


uses
  Classes
  , Controls
  , Windows
  , Messages;


type   TTabControl=class(TWinControl)
    private
      FLeft, FTop, FWidth, FHeight:integer;
      FClientRect:TRect;
      FVisible:Boolean;
      //
      function _getClientRect: TRect;
      function _getHeight: Integer;
      function _getLeft: Integer;
      function _getTop: Integer;
      function _getWidth: Integer;
      function _getParent: TTabControl;
      function _GetVersion: String;
      function _getWindowRect:TRect;
      function _getVisible:Boolean;
      procedure _setVisible(val:Boolean);
    public
      Handle:HWND;
      hContact:Cardinal;
      //
      function Perform (Msg:Cardinal; WParam:integer; LParam:integer):integer;
      function ClientToParent(point:TPoint; pr:ttabcontrol=nil):TPoint;
      //
      constructor Create(Handle:HWND);
      destructor Destroy; override;
    published
      property Left: Integer read _getLeft;
      property Top: Integer read _getTop;
      property Width: Integer read _getWidth;
      property Height: Integer read _getHeight;
      property Parent:TTabControl read _getParent;
      property ClientRect: TRect read _getClientRect;
      property WindowRect: TRect read _getWindowRect;
      property version:String read _getVersion;
      property visible:Boolean read _getVisible write _setVisible;
  end;

implementation
{ TTabControl }


function TTabControl.ClientToParent(point: TPoint; pr: ttabcontrol=nil): TPoint;
var
 _pr:TTabControl;
begin
_pr:=pr;
 if (_pr=nil) then _pr:=self;
 result.X:=self.Left+ point.X;
 result.Y:=self.Top+ point.Y;
end;


constructor TTabControl.Create(Handle:HWND);
begin
  self.Handle:=Handle;
end;

destructor  TTabControl.Destroy;
begin
//
end;

function TTabControl._getClientRect: TRect;
var
  cr:TRect;
begin
  Windows.GetClientRect(handle, cr);
  Result:=cr;
end;

function TTabControl._getWindowRect:TRect;
var
 cr:TRect;
begin
  getWindowRect(handle, cr);
  result:=cr;
end;

function TTabControl._getHeight: Integer;
begin
 result:=WindowRect.Bottom-WindowRect.Top;
end;

function TTabControl._getLeft: Integer;
begin
 Result:=WindowRect.Left;
end;

function TTabControl._getParent: TTabControl;
var
 tc:TTabControl;
begin
  tc:=TTabControl(getparent(Self.Handle));
  result:=tc;
end;


function TTabControl._getTop: Integer;
begin
 result:=WindowRect.Top;
end;

function TTabControl._GetVersion: String;
begin
 result:='1.0';
end;

function TTabControl._getVisible: Boolean;
begin
 result:=FVisible;
end;

procedure TTabControl._setVisible(val: Boolean);
begin
  FVisible:=val;
end;

function TTabControl._getWidth: Integer;
begin
 result:=WindowRect.Right-WindowRect.Left;
end;


function TTabControl.Perform(Msg: Cardinal; WParam, LParam: integer): integer;
begin
 SendMessage(self.Handle, msg, WParam, LParam);
end;




end.
